{{- $inner := trim .Inner "\r\n" }}
{{- if hasPrefix $inner "$$" }}
  <div class="equation leqno" >
    {{- $inner }}
  </div>
{{- else }}
  {{- $inner }}
{{- end }}